package com.github.pig.admin.controller.app;

import com.github.pig.admin.model.app.FeedBack;
import com.github.pig.admin.service.app.IFeedBackService;
import com.github.pig.common.constant.CommonConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.github.pig.common.util.R;
import com.github.pig.common.web.BaseController;

import java.util.Date;

/**
 * <p>
 * 问题反馈 前端控制器
 * </p>
 *
 * @author gaopeng
 * @since 2018-10-11
 */
@RestController
@RequestMapping("/feedBack")
public class FeedBackController extends BaseController {
    @Autowired private IFeedBackService feedBackService;

    /**
     * 添加
     * @param  feedBack  实体
     * @return success/false
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public R<Boolean> add(@RequestBody FeedBack feedBack) {
        feedBack.setCreateUser(getUserName());
        feedBack.setCreateTime(new Date());
        feedBack.setDelFlag(CommonConstant.STATUS_NORMAL);
        return new R<>(feedBackService.insert(feedBack));
    }

}
